package patternrecognition.symbols;

import java.util.List;

import patternrecognition.symbols.forms.Rectangle;

public class O extends Symbol {

	@Override
	public String getID() {
		return "O";
	}

	@Override
	protected boolean isSymbol(final List<Rectangle> rectangles) {
		if (rectangles.size() == 3) {
			Rectangle upperRectangle = rectangles.get(0);
			Rectangle middleRectangle = rectangles.get(1);
			Rectangle lowerRectangle = rectangles.get(2);

			if (upperRectangle.isFilled() && !middleRectangle.isFilled()
					&& lowerRectangle.isFilled()) {
				return upperRectangle.hasSameLeftBorder(middleRectangle)
						&& middleRectangle.hasSameLeftBorder(lowerRectangle)
						&& upperRectangle.hasSameRightBorder(middleRectangle)
						&& middleRectangle.hasSameRightBorder(lowerRectangle);
			}
		}
		return false;
	}

	@Override
	protected Object clone() throws CloneNotSupportedException {
		return new O();
	}
}
